//    Copyright (C) Kherty.  All rights reserved.
using System;
using OpenLS.Core.Serialization;

namespace OpenLS.Spreadsheet
{
    public class ColorFilter: Filter
    {
        internal override void ReadXmlCore(ReadContext context)
        {
            using (ReadContext c = context.Read(xmlName))
            {
                this._differentialStyleRecord = DifferentialStyleRecordHelper.GetDifferentialStyleRecord(c, c.GetOptionalInteger("dxfId"));
                _cellColor = c.GetOptionalBoolean("cellColor", true);
            }
        }
        const string xmlName = "colorFilter";

        internal override void WriteXmlCore(WriteContext context)
        {
            using (WriteContext c = context.Write(xmlName))
            {
                DifferentialStyleRecordHelper.SetDifferentialStyleRecord(c, DifferentialStyleRecord, "dxfId");
                c.SetOptionalBoolean("cellColor", _cellColor, true);
            }
        }
        private bool _cellColor = true;
        private DifferentialStyleRecord _differentialStyleRecord;

        public bool CellColor
        {
            get { return _cellColor; }
            set { _cellColor = value; }
        }

        internal DifferentialStyleRecord DifferentialStyleRecord
        {
            get { return _differentialStyleRecord; }
        }


        internal override bool GetValue(Cell cell, RangeAddress rangeAddress)
        {
            throw new NotImplementedException();
        }

        internal override Func<Cell, bool> GetCellEvaluator(Range range)
        {
            throw new NotImplementedException();
        }
    }
}
